package com.ptszyxx.popose.module.main.mine.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.ptszyxx.popose.R;
import com.ptszyxx.popose.databinding.ItemMineExchangeBinding;
import com.ptszyxx.popose.module.main.mine.vm.MineExchangeVM;
import com.ysg.http.data.entity.exchange.ExchangeEntity;

public class MineExchangeAdapter extends BaseQuickAdapter<ExchangeEntity, BaseDataBindingHolder<ItemMineExchangeBinding>> {

    private MineExchangeVM viewModel;
    public MineExchangeAdapter(MineExchangeVM viewModel) {
        super(R.layout.item_mine_exchange);
        this.viewModel = viewModel;
    }

    @Override
    protected void convert(BaseDataBindingHolder<ItemMineExchangeBinding> holder, ExchangeEntity item) {
        ItemMineExchangeBinding binding = holder.getDataBinding();
        if (binding != null) {
            binding.setEntity(item);
            binding.executePendingBindings();

            binding.tvExchange.setOnClickListener((view -> {
                viewModel.onExchange(item);
            }));
        }
    }

    public static class Presenter{
//        public void onItemClick(MineDynamicVM viewModel, DynamicResult entity){
//            viewModel.jumpDynamicDetail(entity);
//        }
    }








}
